<?php

/*Swoole\Coroutine\System::readFile(__DIR__.'/1.txt',function ($filename,$content)
{
    echo "filename:{$filename}".PHP_EOL;
    echo "content:{$content}".PHP_EOL;

});*/
/**
 * 读取
 */
$filename = __DIR__ . "/1.txt";

Swoole\Coroutine\run(function () use ($filename)
{
    $r = Swoole\Coroutine\System::readFile($filename);
    var_dump($r);
});


/**
 * 写入
 */
$filename = __DIR__ . "/1.txt";
Swoole\Coroutine\run(function () use ($filename)
{
    $content = date("Ymd H:i:s") ."hello 冯勤！";

    $w = Swoole\Coroutine\System::writeFile($filename, $content,FILE_APPEND );
    var_dump($w);
});